package com.minelx.datamicroscope.querylanguage.data.sql;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ContentJoinPoint {

    private final List<ConditionProvider> literalConditions;

    ContentJoinPoint(List<ConditionProvider> literalConditions) {
        this.literalConditions = literalConditions;
    }

    public Map<String, String> onKeyMapping(List<String> fieldAliases) {
        Map<String, String> result = new HashMap<>();
        for (int at = 0; at < fieldAliases.size(); at++) {
            String fieldAlias = fieldAliases.get(at);
            ConditionProvider conditionProvider = literalConditions.get(at);
            result.put(fieldAlias, conditionProvider.left().fieldName());
        }
        return result;
    }
}
